'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const db=uniCloud.database()
	const novelrecords=db.collection("db_novelrecords")
	let {book_id,book_uuid,chapter_index,user_id} =event
	// book_id: "ts_2c9b78ad9af94a99b44d162abd528842_4"
	// book_uuid: "1a129168b99d435e8a1aee0a2f603673_4"
	// chapter_index: 0
	// user_id: "9294_6850567943940724"
	// _id: "6447b5e328064a75870682b2"
	//返回数据给客户端
	return await novelrecords.where({
		book_id,
		user_id
	}).update({
		chapter_index,
		book_uuid
	})
};
